home *** CD-ROM | disk | FTP | other *** search
/ QRZ! Ham Radio 8 / QRZ Ham Radio Callsign Database - Volume 8.iso / pc / files / t_unix / j109lxa4.tar / usock.h < prev    next >
C/C++ Source or Header  |  1994-06-04  |  2KB  |  116 lines

  1. /* Mods by G1EMM */
  2. #ifndef _USOCK_H
  3. #define _USOCK_H
  4.  
  5. #ifndef time_t
  6. #include "time.h"
  7. #endif
  8.  
  9. #ifndef _MBUF_H
  10. #include "mbuf.h"
  11. #endif
  12.  
  13. #ifndef _LZW_H
  14. #include "lzw.h"
  15. #endif
  16.  
  17. #ifndef _PROC_H
  18. #include "proc.h"
  19. #endif
  20.  
  21. #ifndef _TCP_H
  22. #include "tcp.h"
  23. #endif
  24.  
  25. #ifndef _UDP_H
  26. #include "udp.h"
  27. #endif
  28.  
  29. #ifndef _IP_H
  30. #include "ip.h"
  31. #endif
  32.  
  33. #ifndef _NETROM_H
  34. #include "netrom.h"
  35. #endif
  36.  
  37. #ifndef _SOCKADDR_H
  38. #include "sockaddr.h"
  39. #endif
  40.  
  41. struct loc {
  42.     struct usock *peer;
  43.     struct mbuf *q;
  44.     int hiwat;              /* Flow control point */
  45.     int flags;
  46. #define LOC_SHUTDOWN    1
  47. };
  48. #define NULLLOC (struct loc *)0
  49. #define LOCDFLOW        5       /* dgram socket flow-control point, packets */
  50. #define LOCSFLOW        2048    /* stream socket flow control point, bytes */
  51. #define SOBUF           256     /* Size of buffer for usputc()/usprintf() */
  52. #define SOCKBASE        128     /* Start of socket indexes */
  53.  
  54. union sp {
  55.     struct sockaddr *sa;
  56.     struct sockaddr_in *in;
  57.     struct sockaddr_ax *ax;
  58.     struct sockaddr_nr *nr;
  59.     char *p;
  60. };
  61.  
  62. union cb {
  63.     struct tcb *tcb;
  64.     struct ax25_cb *ax25;
  65.     struct udp_cb *udp;
  66.     struct raw_ip *rip;
  67.     struct raw_nr *rnr;
  68.     struct nr4cb *nr4;
  69.     struct loc *local;
  70.     char *p;
  71. };
  72.  
  73. /* User sockets */
  74. struct usock {
  75.     struct proc *owner;
  76.     int refcnt;
  77.     char noblock;
  78.     char type;
  79. #define NOTUSED                 0
  80. #define TYPE_TCP                1
  81. #define TYPE_UDP                2
  82. #define TYPE_AX25I              3
  83. #define TYPE_AX25UI             4
  84. #define TYPE_RAW                5
  85. #define TYPE_NETROML3           6
  86. #define TYPE_NETROML4           7
  87. #define TYPE_LOCAL_STREAM       8
  88. #define TYPE_LOCAL_DGRAM        9
  89.     int rdysock;
  90.     union cb cb;
  91.     char *name;
  92.     int namelen;
  93.     char *peername;
  94.     int peernamelen;
  95.     char errcodes[4];       /* Protocol-specific error codes */
  96.     struct mbuf *obuf;      /* Output buffer */
  97.     struct mbuf *ibuf;      /* Input buffer */
  98.     char eol[3];            /* Text mode end-of-line sequence, if any */
  99.     int flag;               /* Mode flags, defined in socket.h */
  100.     int flush;              /* Character to trigger flush, if any */
  101.     struct lzw *zout;       /* Pointer to compression structure */
  102.     struct lzw *zin;
  103.     time_t created;         /* Time this socket was opened */
  104. };
  105. #define NULLUSOCK       ((struct usock *)0)
  106.  
  107. extern char Badsocket[];
  108. extern char *Socktypes[];
  109. extern struct usock *Usock;
  110. extern int Nusock;
  111.  
  112. struct usock *itop __ARGS((int s));
  113. void st_garbage __ARGS((int red));
  114.  
  115. #endif /* _USOCK_H */
  116.